import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect:'/home',
    component: () => import('../views/Home.vue'),
    children:[
      {
        path: '/home/:id',
        name: 'home',
        components:{
          default: () => import('../views/Test/Test.vue'),
          Test1: ()=> import('../views/Test/Test1.vue'),
          Test2: ()=> import('../views/Test/Test2.vue')
        } ,
        props:{
          default:true,
          Test1:true,
          Test2:true
        },
        children:[
          {
            path: '/home/:id/test1/:id',
            props:true,
            name: '/test1',
            component: () => import('../views/childrenTest/childrenTest.vue')
          },
          {
            path: 'test2',
            name: 'test2',
            component: () => import('../views/childrenTest/childrenTest1.vue')
          }
        ]
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
